home *** CD-ROM | disk | FTP | other *** search
- /*
- syslog internals.h
-
- Header file
-
- */
-
- #ifndef __H_Syslog_Internals__
- #define __H_Syslog_Internals__
-
- #include <Components.h>
- #include <Notification.h>
- #include <Processes.h>
- #include <Packages.h>
-
- #ifndef kComponentWildCard
- #define kComponentWildCard 0L
- #endif
-
- typedef struct ComponentStorageStruct ComponentStorageRec,
- * ComponentStoragePtr,** ComponentStorageHdl;
-
- #if defined(powerc) || defined (__powerc)
- #pragma options align=mac68k
- #endif
- struct ComponentStorageStruct {
- Component self;
- ComponentInstance kidnapper;
- Component delegate;
- ComponentInstance delegated;
- short resFileRefNum;
-
- // Add component specific storage requirements here
- short refnum;
- FSSpec spec;
- short specvalid;
- short mask;
- short facility;
- long logopts;
- char ident[100];
-
- OSErr err;
-
- // international utilities handle
- Intl0Hndl i0h;
-
- /*
- The following fields are used to remember stuff about the true syslog.
- These are saved when openlog is called and restored when closelog is called.
- */
-
- short vRefNum; // file references
- long dirID;
-
- long slogopts;
- short sfacility;
- short smask;
-
- short openCalled; // to keep track of when to save and when not to save
- short needSaved;
- };
- #if defined(powerc) || defined(__powerc)
- #pragma options align=reset
- #endif
-
- enum {
- uppCallComponentProcInfo=kPascalStackBased
- | RESULT_SIZE(kFourByteCode)
- | STACK_ROUTINE_PARAMETER(1,kFourByteCode)
- };
-
- typedef pascal ComponentResult (*CompStorageProcPtr)(Handle storage,ComponentInstance self);
- typedef pascal ComponentResult (*CompShortProcPtr)(short count);
- typedef pascal ComponentResult (*CompVoidProcPtr)(void);
-
- typedef pascal ComponentResult (*CompOpenlogProcPtr)(Handle storage,const char* ident,long logopt,short facility);
- typedef pascal ComponentResult (*CompSyslogProcPtr)(Handle storage,short priority,const char* message);
- typedef pascal ComponentResult (*CompHandleProcPtr)(Handle storage);
- typedef pascal ComponentResult (*CompSetlogmaskProcPtr)(Handle storage,short maskpri);
- typedef pascal ComponentResult (*CompSetFileProcPtr)(Handle storage,FSSpecPtr spec);
-
- typedef pascal ComponentResult (*CompOSErrPtrProcPtr)(Handle storage,OSErr* err);
-
- enum {
- uppCallComponentWithStorageProcInfo=kPascalStackBased
- | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
- | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Handle)))
- | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(ComponentInstance))),
- uppCallComponentShortProcInfo=kPascalStackBased
- | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
- | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(short))),
- uppCallComponentOSErrPtrProcInfo=kPascalStackBased
- | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
- | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Handle)))
- | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(OSErr*))),
- uppCallComponentVoidProcInfo=kPascalStackBased
- | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult))),
- uppCallComponentOpenlogProcInfo=kPascalStackBased
- | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
- | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Handle)))
- | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(const char*)))
- | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(long)))
- | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(short))),
- uppCallComponentHandleProcInfo=kPascalStackBased
- | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
- | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Handle))),
- uppCallComponentSyslogProcInfo=kPascalStackBased
- | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
- | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Handle)))
- | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(short)))
- | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(const char*))),
- uppCallComponentSetlogmaskProcInfo=kPascalStackBased
- | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
- | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Handle)))
- | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(short))),
- uppCallComponentSetFileProcInfo=kPascalStackBased
- | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
- | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Handle)))
- | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(FSSpecPtr)))
- };
-
- #if USESROUTINEDESCRIPTORS
- typedef ComponentFunctionUPP ComponentWithStorageUPP;
- typedef ComponentFunctionUPP ComponentShortUPP;
- typedef ComponentFunctionUPP ComponentVoidUPP;
- typedef ComponentFunctionUPP ComponentOpenlogUPP;
- typedef ComponentFunctionUPP ComponentSyslogUPP;
- typedef ComponentFunctionUPP ComponentHandleUPP;
- typedef ComponentFunctionUPP ComponentSetlogmaskUPP;
- typedef ComponentFunctionUPP ComponentSetFileUPP;
- typedef ComponentFunctionUPP ComponentOSErrPtrUPP;
-
- #define CallComponentWithStorageProc(routine,sto,self)\
- CallUniversalProc((UniversalProcPtr)routine,uppCallComponentWithStorageProcInfo,(sto),(self))
- #define NewComponentWithStorageProc(routine)\
- (ComponentWithStorageUPP)NewRoutineDescriptor((ProcPtr)routine,uppCallComponentWithStorageProcInfo,GetCurrentISA())
-
- #define CallComponentShortProc(routine,val)\
- CallUniversalProc((UniversalProcPtr)routine,uppCallComponentShortProcInfo,(val))
- #define NewComponentShortProc(routine)\
- (ComponentShortUPP)NewRoutineDescriptor((ProcPtr)routine,uppCallComponentShortProcInfo,GetCurrentISA())
-
- #define CallComponentVoidProc(routine)\
- CallUniversalProc((UniversalProcPtr)routine,uppCallComponentVoidProcInfo)
- #define NewComponentVoidProc(routine)\
- (ComponentVoidUPP)NewRoutineDescriptor((ProcPtr)routine,uppCallComponentVoidProcInfo,GetCurrentISA())
-
- #define NRD(routine,procinfo) NewRoutineDescriptor((ProcPtr)routine,procinfo,GetCurrentISA())
-
- #define NewComponentOpenlogProc(routine) \
- (ComponentOpenlogUPP)NRD((routine),uppCallComponentOpenlogProcInfo)
- #define NewComponentSyslogProc(routine) \
- (ComponentSyslogUPP)NRD((routine),uppCallComponentSyslogProcInfo)
- #define NewComponentHandleProc(routine) \
- (ComponentHandleUPP)NRD((routine),uppCallComponentHandleProcInfo)
- #define NewComponentSetlogmaskProc(routine) \
- (ComponentSetlogmaskUPP)NRD((routine),uppCallComponentSetlogmaskProcInfo)
- #define NewComponentSetFileProc(routine) \
- (ComponentSetFileUPP)NRD((routine),uppCallComponentSetFileProcInfo)
- #define NewComponentOSErrPtrProc(routine) \
- (ComponentOSErrPtrUPP)NRD((routine),uppCallComponentOSErrPtrProcInfo)
-
- #else
- typedef CompStorageProcPtr ComponentWithStorageUPP;
- typedef CompShortProcPtr ComponentShortUPP;
- typedef CompVoidProcPtr ComponentVoidUPP;
- typedef CompOpenlogProcPtr ComponentOpenlogUPP;
- typedef CompSyslogProcPtr ComponentSyslogUPP;
- typedef CompHandleProcPtr ComponentHandleUPP;
- typedef CompSetlogmaskProcPtr ComponentSetlogmaskUPP;
- typedef CompSetFileProcPtr ComponentSetFileUPP;
- typedef CompOSErrPtrProcPtr ComponentOSErrPtrUPP;
-
- #define CallComponentWithStorageProc(routine,sto,self)\
- (*routine)((sto),(self))
- #define NewComponentWithStorageProc(routine)\
- (ComponentWithStorageUPP)(routine)
-
- #define CallComponentShortProc(routine,val)\
- (*routine)((val))
- #define NewComponentShortProc(routine)\
- (ComponentShortUPP)(routine)
-
- #define CallComponentVoidProc(routine)\
- (*routine)()
- #define NewComponentVoidProc(routine)\
- (ComponentVoidUPP)(routine)
-
- #define NRD(routine,val) (routine)
-
- #define NewComponentOpenlogProc(routine) \
- (ComponentOpenlogUPP)NRD((routine),uppCallComponentOpenlogProcInfo)
- #define NewComponentSyslogProc(routine) \
- (ComponentSyslogUPP)NRD((routine),uppCallComponentSyslogProcInfo)
- #define NewComponentHandleProc(routine) \
- (ComponentHandleUPP)NRD((routine),uppCallComponentHandleProcInfo)
- #define NewComponentSetlogmaskProc(routine) \
- (ComponentSetlogmaskUPP)NRD((routine),uppCallComponentSetlogmaskProcInfo)
- #define NewComponentSetFileProc(routine) \
- (ComponentSetFileUPP)NRD((routine),uppCallComponentSetFileProcInfo)
- #define NewComponentOSErrPtrProc(routine) \
- (ComponentOSErrPtrUPP)NRD((routine),uppCallComponentOSErrPtrProcInfo)
-
- #endif
-
- #define DisposeComponentWithStorageProc(routine)\
- DisposeRoutineDescriptor((UniversalProcPtr)routine)
- #define DisposeComponentShortProc(routine)\
- DisposeRoutineDescriptor((UniversalProcPtr)routine)
- #define DisposeComponentVoidProc(routine)\
- DisposeRoutineDescriptor((UniversalProcPtr)routine)
-
- #define DRD(routine) DisposeRoutineDescriptor((UniversalProcPtr)routine)
-
- #define DisposeComponentOpenlogProc(routine) DRD(routine)
- #define DisposeComponentSyslogProc(routine) DRD(routine)
- #define DisposeComponentHandleProc(routine) DRD(routine)
- #define DisposeComponentSetlogmaskProc(routine) DRD(routine)
- #define DisposeComponentSetFileProc(routine) DRD(routine)
- #define DisposeComponentOSErrPtrProc(routine) DRD(routine)
-
- #endif /* __H_Syslog_Internals__ */
-
-
-
-
-